id: task-166 title: Audit and fix autoCommit behavior across all commands status: Done assignee: [] created_date: '2025-07-07' labels:
- bug
- config dependencies: [] priority: high
Description
Task 164 implemented autoCommit configuration to prevent automatic commits, but we missed applying this to backlog init and potentially other commands. Need to audit all git operations and ensure they respect the autoCommit config setting.
Acceptance Criteria
- [x]
backlog initrespects autoCommit config setting (currently always commits) - [x]
addAgentInstructionsfunction respects autoCommit config (currently always commits) - [x] All CLI commands that trigger git operations check autoCommit config
- [x] No hardcoded
autoCommit = truedefaults remain in the codebase - [x] All tests pass and verify autoCommit behavior is consistent (existing git issues unrelated to autoCommit)
- [x] Update any documentation if needed (no documentation changes required - behavior now consistent)
Implementation Plan
- Fix initializeProject method: Remove
autoCommit = truedefault, make it respect config - Fix CLI init command: Pass autoCommit parameter based on config to initializeProject
- Fix addAgentInstructions: Add autoCommit parameter and respect it for git operations
- Audit other commands: Check agents, config, and any other commands that might commit
- Add tests: Ensure all fixed commands have tests for autoCommit behavior
- Update documentation: Document any behavior changes
Implementation Notes
Fixed initializeProject method:
- Changed default from
autoCommit = truetoautoCommit = falseto match config default - Method now defaults to not auto-committing, consistent with config interface
Fixed CLI init command:
- Simplified to call
initializeProject(name)without explicit parameter - Relies on method's default
autoCommit = falsebehavior - Passes explicit
falsetoaddAgentInstructions
Fixed addAgentInstructions function:
- Added
autoCommit = falseparameter with default false - Updated git commit logic to check
autoCommitparameter - Updated all call sites to pass autoCommit parameter
Fixed CLI agents command:
- Updated to get autoCommit setting from config before calling
addAgentInstructions
Files Modified:
src/core/backlog.ts- Fixed initializeProject method default toautoCommit = falsesrc/cli.ts- Simplified init command to use method defaultsrc/agent-instructions.ts- Added autoCommit parameter to addAgentInstructionssrc/test/auto-commit.test.ts- Updated test to explicitly passtruewhen expecting commitssrc/test/cli.test.ts- Updated git integration test to explicitly passtruewhen expecting commits